<template>
  <div>
   <el-card class="box-card">

     <el-form :inline="true" :model="formInline" class="demo-form-inline">
       <el-form-item label="方向名称">
         <el-input v-model="formInline.name" placeholder="方向名称"></el-input>
       </el-form-item>

       <el-form-item>
         <el-button type="primary" @click="onSubmit">查询</el-button>
         <el-button type="primary" @click="toAdd">新增</el-button>
       </el-form-item>
     </el-form>

     <el-table
       :data="tableData"
       style="width: 100%">
       <el-table-column
         prop="id"
         label="id"
         width="180">
       </el-table-column>
       <el-table-column
         prop="name"
         label="方向名称"
         width="180">
       </el-table-column>

     </el-table>
     <el-pagination
       @size-change="handleSizeChange"
       @current-change="handleCurrentChange"
       :current-page="currentPage4"
       :page-sizes="[1, 2, 3, 4]"
       :page-size="paize"
       layout="total, sizes, prev, pager, next, jumper"
       :total="total">
     </el-pagination>

   </el-card>
  </div>
</template>

<script>
  // const axios = require('axios');
  export default {
    data() {
      return {
        tableData: [],
        formInline: {
          user: '',
          region: ''
        },
        currentPage4: 4,
        paize:3,
        total:10,
      }

    },
    created(){
      this.$axios.get("college/list").then((res)=>{
        console.log(res.data.data)
        this.tableData = res.data.data
      })
    },
    methods: {
      toAdd(){
        this.$router.push({name:"Subject",params:{id:row.id}})
      },
      showList(val) {
        console.log(`每页 ${val} 条`);
        this.pagesize =val
       this.$axios.get("college/page?page='+this.currentPage4+'&size='+this.pagesize).then((res)=>{
        this.tabledate = res.data.tada
       }
      },
      handLSizeChange(val) {
        this.formInLine.page=1
        this.showList()
        this.$axios.get("college/page?page='+this.currentPage4+'&size='+this.pagesize).then((res)=>{
        this.tabledate = res.data.data.records
  },

      onSubmit(){
      this.formInLine.page=1
        this.showList()
      this.showList()
       }


  }
</script>

<style scoped>

</style>
